<?php

class Core_Model_Permission_Collection_Account extends Dcmp_Model_Collection_Strong {

    public function __construct(){
        parent::__construct();
        $this->setItemClass('permission/account');
        $this->from('{t}permission_account', 'a')
             ->select()->field('a.*')->distinct();
    }

    public function  filterBy($name, $arg) {
        switch($name){
            case 'status':
                return $this->eq('a.status', ':status:s')->addParameter('status', $arg);
            case 'enabled':
                return $this->eq('a.status', "'enabled'");
            case 'disabled':
                return $this->eq('a.status', "'disabled'");
            case 'ids':
            	return $this->contain('a.id', ':ids:i')->addParameter('ids', $arg);
        }
        parent::filterBy($name, $arg);
    }
}